/**
 * Created by Administrator on 2016/6/13.
 */

 var serviceHttp = 'http://inmycars.ihengtian.top/';
// var serviceHttp = 'http://192.168.1.240:8999/';
// var serviceHttp = 'http://localhost:8999/';


/*userLogin--�û���¼*/
var buildings = angular.module('buildingsApp', [], function () {
});

var buildingsController = function ($http, $scope) {
    function GetRequest() {
        var url = location.search; //�
        var theRequest = new Object();
        if (url.indexOf("?") != -1) {
            var str = url.substr(1);
            strs = str.split("&");
            for(var i = 0; i < strs.length; i ++) {
                var key = strs[i].split("=")[0];
                var value =unescape(strs[i].split("=")[1]);
                if(key == "name") {
                    var unicodeStr = BASE64.decoder(value);
                    value = '';
                    for(var i = 0 , len =  unicodeStr.length ; i < len ;++i){
                        value += String.fromCharCode(unicodeStr[i]);
                    }
                }
                theRequest[key]=value;

            }
        }
        return theRequest;
    }
        var Req = new Object();
        Req = GetRequest();

        $http.get(serviceHttp + 'api/rest/firm/buildings/' + Req["name"]).success(function (res) {
            $scope.buildings = res.data;
        });

        $scope.next = function(buildId){
            window.location.href = "floors.html?buildId=" + buildId;
        }
}

